package com.sun.wanandroid.net

import com.sun.module_base.network.NetworkApi
import com.sun.module_common.config.BASE_URL
import com.sun.module_common.model.UserInfo
import com.sun.module_network.HttpResult
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

/**
 *@author:sunc
 *@time :2025/7/30 15:56
 *@desc: 描述
 */
interface ApiService {
    companion object {
        fun getInstance(): ApiService {
            return NetworkApi.INSTANCE.getApi(ApiService::class.java, BASE_URL)
        }
    }

    @FormUrlEncoded
    @POST("/user/login")
    suspend fun login(
        @Field("username") userName: String,
        @Field("password") password: String,
    ): HttpResult<UserInfo?>

    @FormUrlEncoded
    @POST("/user/register")
    suspend fun register(
        @Field("username") userName: String,
        @Field("password") password: String,
        @Field("repassword") rePassword: String,
    ): HttpResult<UserInfo?>
}